<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/2/23
 * Time: 15:12
 */
class Api_Index extends PhalApi_Api{
    public function getRules(){
        return array(
            'getByUser' => array(
                'id' => array('name'=>'id','require'=>true),
            ),
            'sendPhone' => array(      //发送用户信息
                                       'phone' => array('name' => 'phone','require' => true,'min' => 11,'max' => 11),
            ),
            'getClientList'=>array(   //获取活动商家列表

            ),
            'getCurrentPhone'=>array(  //判断用户是否投票权限
                                       'phone'=>array('name'=>'phone','require'=>true),
            ),
            'doShare' => array(//分享
                               'phone' => array('name' => 'phone','require' => true,'min' => 11,'max' => 11),
            ),
            'setVote'=>array(    //投票
                                 'shopid' => array('name'=>'shopid','require'=>true),
                                 'phone'=>array('name'=>'phone','require'=>true),
            ),
            'addInsurance' => array(//提交表单
                                    'uname' => array('name' => 'uname','require' => true),
                                    'id_no' => array('name' => 'id_no','require' => true,'min' => 18,'max' => 18),
                                    'phone' => array('name' => 'phone','require' => true,'min' => 11,'max' => 11),
            ),
            'getGift' => array(   //用户当天抽奖
                                  'phone' => array('name'=>'phone','require'=>true),

            ),
            'falseInfo' =>array(
                //更新假数据
            ),
        );
    }
    /*
     * 更新假数据
     */
    public function falseInfo(){
        $Domain_Test = new Domain_Index();
         $Domain_Test -> falseInfo();
    }
    //测试
    public function getByUser(){
        $Domain_Test = new Domain_Index();
        $data = $Domain_Test -> getByUser();
        return $data;
    }
    /*
     * 发送用户信息  保存手机号码信息入库
     */
    public function sendPhone(){
        $Domain_Phone = new Domain_Index();
        $Domain_Phone -> getByPhone($this);
    }
    /*
     * 活动商家列表当前总票数
     */
    public function getClientList(){
        $Domain_Client = new Domain_Index();
        return $Domain_Client -> getClientList();
    }
    /*
     *点击投票按钮，当前用户是否投满三家，投票权限
     */
    public function getCurrentPhone(){
        $Domain_CurrentPhone = new Domain_Index();
        return $Domain_CurrentPhone -> getCurrentPhone($this);
    }
    /**
     * 分享
     */
    public function doShare(){
        $Domain_Phone = new Domain_Index();
        $Domain_Phone->doShare($this);
    }
    /**
     * 保存保单
     */
    public function addInsurance(){
        $Domain_Phone = new Domain_Index();
        return $res = $Domain_Phone->addInsurance($this);
    }
    /*
    * 投票
    */
    public function setVote(){
        $Domain_Vote = new Domain_Index();
        return $Domain_Vote -> setVote($this);
    }
    /*
     * 用户当天抽奖
     */
    public function getGift(){
        $Domain_Gift = new Domain_Index();
        return $Domain_Gift -> getGift($this);
    }
}